/*********************************************************
          File Name:pisces_process.h
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 24 Apr 2015 09:26:04 PM CST
**********************************************************/

#ifndef PISCES_PROCESS_H_
#define PISCES_PROCESS_H_

#include "global.h"
#include "header.h"
#include "pisces_signal.h"
#include "pisces_log.h"
#include "pisces_event.h"

#define R_F         0
#define W_F         1

typedef void (*pisces_process_t) (pisces_ctx_t *, void *);

pid_t pisces_make_workprocess(pisces_ctx_t *, int);

void pisces_get_workprocess_id(pisces_ctx_t *);

void pisces_workprocess(pisces_ctx_t *, int);

void pisces_renew_workprocess(pisces_ctx_t *);

void pisces_stop(pisces_ctx_t *);

void pisces_wait_child(void);

void pisces_ignore_child(void);

void pisces_master_control(char **);

int pisces_pidfile(pid_t *, int);

void pisces_drop_privilige(void);

void pisces_workthread(void *);

#endif
